package com.trace.meat;


import com.trace.meat.controller.*;
import com.trace.meat.entity.*;
import com.trace.meat.service.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import javax.servlet.http.HttpServletRequest;
import java.lang.Process;
import java.util.*;

@SpringBootTest
public class test {
    @Autowired
    private OrderTblService orderTblService;
    @Autowired
    private AnimalController AC;
    @Autowired
    private BreederController BC;
    @Autowired
    private AdminAcctController adminAcctController;
    @Autowired
    private EntController entController;
    @Autowired
    private ProductController PC;
    @Autowired
    private LicService LS;
    @Autowired
    private EntService ES;
    @Autowired
    private AnimalService AS;
    @Autowired
    private BreederService BS;
    @Autowired
    private ButcherService BCS;
    @Autowired
    private ProductService PS;
    @Autowired
    private OrderTblController OTC;
    @Autowired
    private HandleController handleController;
    @Autowired
    private TypeTblService TTC;
    @Autowired
    private ProcessService processService;
    @Test
    void fn()
    {
        /**  //注册测试用例
        System.out.println(entController.register("clearloveA","cleralove4396",
                101,"1545648","厂长养猪厂",null));
        System.out.println(entController.register("7","cleralove4396",
                101,"1545648","厂长养猪厂2",null));
        System.out.println(entController.register("clearloveA2","4396",
                101,"1545648","厂长养猪厂3",null));
        System.out.println(entController.register("","cleralove4396",
                101,"1545648","厂长养猪厂4",null));
        System.out.println(entController.register("clearloveA4","cleralove4396",
                101,"1545648","厂长养猪厂6","clearlove@edg.com"));
        */
        /** //登录
        System.out.println(entController.login("clearloveA","cleralove4396"));
        System.out.println(entController.login("clearloveA","cleralove"));
        System.out.println(entController.login("clearlove4546","cleralove4396"));
         */
        /**  //企业信息修改
        System.out.println(entController.update(30,101,null,"厂长4396","clearlove114514@edg.com"));
        System.out.println(entController.update(30,101,null,"厂长4396","clearlove114514edg.com"));
         */
        /** //企业密码修改
        System.out.println(entController.editPassword(30,"clearlove","clearlove4396"));
        System.out.println(entController.editPassword(30,"cleralove4396","clearlove7777"));
        System.out.println(entController.editPassword(30,"cleralove4396","ji"));
         */
        /**  //添加饲养员
        System.out.println(entController.AddBreeder("clear",1145));
        System.out.println(entController.AddBreeder("uzi",30));
         */
        /**查询饲养员列表
        System.out.println(entController.SelectAllBreeder(30));
        System.out.println(entController.SelectAllBreeder(1145));
         System.out.println(entController.SelectAllBreeder(29));
         */
        /** //添加经营者
        System.out.println(entController.AddButcher("uzi",1145));
        System.out.println(entController.AddButcher("uzi",30));
         */
        /** //经营者列表
        System.out.println(entController.SelectAllButcher(30));
        System.out.println(entController.SelectAllButcher(1145));
         System.out.println(entController.SelectAllButcher(29));
         */
        /** //牲畜添加
        System.out.println(entController.AddAnimal(5001,50010001,9));
        System.out.println(entController.AddAnimal(5001,50010001,415));
        */
        /**  //牲畜列表
        System.out.println(entController.SelectAllAnimal(30));
        System.out.println(entController.SelectAllAnimal(29));
        System.out.println(entController.SelectAllAnimal(1145));
         */
        /** 添加加工

        System.out.println(entController.AddProduct(5001002,1.0,8,19));
        System.out.println(entController.AddProduct(5001002,1.0,815,19));
        System.out.println(entController.AddProduct(5001002,1.0,8,19154));
        */
        /** 查询加工
        System.out.println(entController.SelectALlProcess(30));
        System.out.println(entController.SelectALlProcess(29));
        System.out.println(entController.SelectALlProcess(1154));
         */
         //收货相关
        /**
        System.out.println(entController.confirm(2,19,0,null,null));
        System.out.println(entController.confirm(2,19,0,null,null));
        System.out.println(entController.confirm(3,1545,0,null,null));
        System.out.println(entController.confirm(3,1545,1,null,null));
        System.out.println(entController.confirm(3,17,1,null,null));
         */
        /** //售出订单
        System.out.println(entController.List_Out(30));
        System.out.println(entController.List_Out(29));
         */
        /** //收货订单
        System.out.println(entController.List_In(2));
        System.out.println(entController.List_In(29));
         */
        /** //最后位置
        System.out.println(entController.lastPosition(19,0));
        System.out.println(entController.lastPosition(1145,0));
        */
        /** //添加证书
        System.out.println(entController.AddLic(30,"1145",1));
        System.out.println(entController.AddLic(11545,"1145",1));
         */
        /** //证书列表
        System.out.println(entController.SelectAllLic(30));
        System.out.println(entController.SelectAllLic(29));
        System.out.println(entController.SelectAllLic(2915));
        */
        /** //上架
        System.out.println(entController.AddStock(30,11,17,1));
        System.out.println(entController.AddStock(487,11,17,1));
        System.out.println(entController.AddStock(30,11,177,1));
        */
        /** 查询货架列表
        System.out.println(entController.SelectAllStock(30));
        System.out.println(entController.SelectAllStock(29));
        System.out.println(entController.SelectAllStock(1157));
         */
         /** //货物基本信息
        System.out.println(handleController.SelectG(19,0));
        System.out.println(handleController.SelectG(17,1));
        System.out.println(handleController.SelectG(15,3));
        System.out.println(handleController.SelectG(4545,1));
        */
        /** //链条合成
        System.out.println(handleController.Chain_Form(1,0));
        System.out.println(handleController.Chain_Form(16,1));
        System.out.println(handleController.Chain_Form(1545,0));
        System.out.println(handleController.Chain_Form(16,3));
        */
        /** //证书查询
        System.out.println(adminAcctController.Lic_Screen(null,1,"1145",0));
        System.out.println(adminAcctController.Lic_Screen("a养殖场",1,"12",1));
         */
        /** 企业查询
        System.out.println(adminAcctController.Account_Screen(null,"獭子",null,null,null));//msg='筛选成功'
         System.out.println(adminAcctController.Account_Screen("dadasda","獭子",null,null,null));
        */
        /** //重置token
        System.out.println(adminAcctController.ResetEntToken(30));
        System.out.println(adminAcctController.ResetEntToken(458));
         */
        /** //设置证书状态
        System.out.println(adminAcctController.SetLicState(9,1));
        System.out.println(adminAcctController.SetLicState(999,1));
         */
        /** //修改企业信息
        System.out.println(adminAcctController.EditEnt(30,101,null,"厂长4396","clearlove114514@edg.com"));
        System.out.println(adminAcctController.EditEnt(30,101,null,"厂长4396","clearlove114514edg.com"));
        */
        //System.out.println(adminAcctController.Lic_Screen("a养殖场",1,"12",1));
        //System.out.println(processService.queryByPId(9));
        //System.out.println(HC.Chain_Form(9,1));
        //System.out.println(AAC.Lic_Screen(null,null,null,null));
        //System.out.println(AAC.Account_Screen(null,"獭子",null,null,null));
        //System.out.println(LS.getModelByEId(1));
        //System.out.println(AAC.Account_Screen(null,"李田所养猪厂",null,null,null));
        //System.out.println(AAC.Account_Screen(null,null,null,null,null));
        //System.out.println(EC.AddStock(1,1,2,1));
        //System.out.println(EC.SelectALlProcess(2));
        //System.out.println(EC.lastPosition(9,0));
        //System.out.println(AAC.Account_Screen(null,null,null,null,null));
        //System.out.println(AAC.register("clearloveadmin","4396777"));
        /**Lic lic=new Lic();
        lic.setLicType(null);
        lic.setEid(null);
        lic.setSerNum(null);
        System.out.println(LS.queryAll(lic));
         */
        //System.out.println(EC.confirm(1,1,1,"4545",""));
        //System.out.println(EC.SelectAllStock(1));
        //System.out.println(EC.AddAnimal(5001,50010001,7));
        //System.out.println(EC.SelectAllButcher(1));
//        System.out.println(EC.SelectAllProductType(5001));
//        System.out.println(EC.SelectAllBreedType(5001));
//        System.out.println(EC.SelectAllAnimalType());
        //System.out.println(TTC.queryAllById(101,104));
        //System.out.println(EC.SelectAllEntType());
        //System.out.println(EC.SelectAllLicType());
        //System.out.println(TTC.queryAllType());
        //System.out.println(new Date().getTime());
        //System.out.println(LS.getModelByEId(1));
        //System.out.println(EC.UpdateAnimal(1,"2021-6-26",5001,50010001,1,3,(short) 1));
        //System.out.println(OTC.Chain_Form(1,0));
        //System.out.println(EC.SelectAllAnimal(1));
        //System.out.println(EC.SelectAllBreeder(1));
        //System.out.println(BS.queryModelByEId(1));
        //System.out.println(AS.queryModelByBId(1));
        /**
        Hashtable hashtable=new Hashtable();
        List<Integer> list1=new ArrayList<Integer>();
        list1.add(1);
        list1.add(2);
        hashtable.put("list1",list1);
        List<Integer> list2=new ArrayList<Integer>();
        list2.add(7);
        list2.add(7);
        hashtable.put("list2",list2);
        System.out.println(hashtable.get("list1"));
        System.out.println(hashtable.get("list2"));
     */
     /**
        Result result=HC.Chain_From(3);
        System.out.println(result);
         */
        /**List<OrderTbl> orderTbl=OTC.Chain_Form(4);
        Iterator it=orderTbl.listIterator();
        OrderTbl o=(OrderTbl) it.next();
        System.out.println(o);*/
        //System.out.println(PS.queryModelById(1));
        //System.out.println(orderTblService.queryModelById(1));
        //System.out.println(BCS.queryModelById(1));
        //System.out.println(BS.queryModelById(1));
        //System.out.println(AS.queryModelById(1));
        //System.out.println(ES.queryModelById(1));
        //System.out.println(LS.getModelById(1));
        //System.out.println(this.EC.queryByToken("209d4e0c214145b8a0aa1571e1c62ec5"));
        //this.PC.insert(5001001,Double.valueOf(1),"2021-6-24",1,(short)1,1,1);
        //AAC.register("uziadmin","2200");
        //String uuid = UUID.randomUUID().toString().replaceAll("-","");
        //System.out.println(uuid);
        //Result result=AAC.login("clearloveadmin","4396");
        //Result result=AAC.register("clearloveadmin","4396777");
        /**管理员账号登录注册
         *
        Result result=AAC.register("clearloveadmin","4396777");
        System.out.println(result);
        result=AAC.login("clearloveadmin","4396777");
        System.out.println(result);
         */

        //Result result=EC.login("dasda","1545");

        //EC.register("clearlovetu","1145141",102,"1919810","屠宰厂");
        /**企业账号注册登陆
         *
         System.out.println(EC.register("clearloveyangzhi","1145141",1,"1919810","养猪厂"));
        Result result= EC.login("clearloveyangzhi","1145141");
        result.getDetail();
        System.out.println(result);
         */
         /**状态码
        System.out.println(StateCode.Login_Fail.getState());
        System.out.println(StateCode.Login_Fail.getCodenum());
        System.out.println(StateCode.Login_Fail.toString());
        */
         /**加密
        String temp=bCryptPasswordEncoder.encode("114514");
        System.out.println(temp);
        System.out.println(bCryptPasswordEncoder.matches("114514",temp));
         */
        /**按企业编号生成列表
        Iterator<Breeder> it=BC.selectAllByEid(1).listIterator();
        while (it.hasNext())
        {
            System.out.println(it.next());
        }*/
    }

}
